<template>
  <div id="div">
    <h4>{{newInfo.title}}</h4>        
    <div class="time">
      <span>发表时间:{{newInfo.add_time | dateFormat}}</span> <span>点击:{{newInfo.click}}</span>
    </div>

    <hr>
    <div v-html="newInfo.content"></div>

    <comment :newsId="this.id"></comment>
  </div>
</template>

<script>
import comment from '@/components/comment/comment'
export default {
  data (){
    return {
      id:this.$route.params.id,
      newInfo:[]
    }
  },
  created(){
    this.getNewInfo()
  },
  methods: {
    getNewInfo(){
      this.$http.get('api/getnew/'+this.id).then(result=>{
        this.newInfo=result.body.message[0]
      })
    }
  },
  components:{
    'comment': comment
  }
}
</script>

<style scoped>
  h4 {
    font-size: 18px;
    color: crimson;
    text-align: center;
    margin: 10px 0;
  }
  #div {
    padding: 0 10px;
  }
  .time {
    display: flex;
    justify-content: space-between;
    font-size: 12px;
    color: cornflowerblue;
  }
</style>
